// 用来配置文件的别名，方便路径的寻找
const path = require('path') // 引入path模块
function resolve (dir) {
  return path.join(__dirname, dir) // path.join(__dirname)设置绝对路径
}

module.exports = {
  configureWebpack: {
    resolve: {
      alias: {
        assets: '@/assets',
        components: '@/components',
        views: '@/views',
        common: '@/common',
        network: '@/network',
        utils: '@/utils',
        api: '@/api',
        router: '@/router',
        store: '@/store',
        hooks: '@/hooks'
      }
    }
  },

  lintOnSave: false,
  devServer: {
    overlay: {
      warning: false,
      errors: false
    }
    // 关闭eslint
    // lintOnSave: false,
  },

  pluginOptions: {
    'style-resources-loader': {
      preProcessor: 'less',
      patterns: [
        resolve('./src/assets/style/mixins.less'),
        resolve('./src/assets/style/variables.less')
      ]
    }
  },
  // 提前打包小图片
  chainWebpack: config => {
    config.module
      .rule('images')
      .use('url-loader')
      .loader('url-loader')
      .tap(options => Object.assign(options, {
        limit: 10000
      }))
  }
}
